package com.jshop.utils;

import java.math.BigInteger;
import java.security.MessageDigest;

public class Md5Util {
	/**
	 * 对字符串md5加密
	 *
	 * @param str
	 * @return
	 */
	public static String md5(String str) {
	    try {
	        MessageDigest md = MessageDigest.getInstance("MD5");
	        md.update(str.getBytes());
	        return new BigInteger(1, md.digest()).toString(16);
	    } catch (Exception e) {
	        return null;
	    }
	}
}
